<!DOCTYPE html>
<html>

<head>
    <title>车队管理系统</title>

    {include file="common/header"/}
            <el-main>
                <h1>欢迎您，{{ username }}({{ group }})</h1>
                <h2>登录时间：{{update_time}}</h2>
            </el-main>
    {include file="common/footer"/}
<script>
    new Vue({
        el: '#app',
        data:{
            username : "",
            group : "",
            update_time:"",
        },
        mounted () {
            // this.baiduMap();
            // this.username = getCookie('username');
            this.abcd();
        },

        methods: {
            logOut() {
                var that = this;
                axios.post('user/logout')
                    .then(function (response)
                    {
                        if (response.data.code == 200) {
                            that.$message({
                                message: '退出成功,正在跳转中',
                                type: 'success'
                            });
                            setTimeout(function () {
                                location.replace('');
                            }, 1000)
                        } else {
                            that.$message.error(response.data.msg);
                        }
                    })
                    .catch(function (error)
                    {
                        that.$message.error('tuichu失败，服务器内部错误');
                    });
            },
            abcd(){
                var that = this;
                axios.post('user/getmyvalue')
                    .then(function (response)
                    {
                        that.username = response.data.data.name;
                        a = response.data.data.group;
                        that.update_time = response.data.data.update_time;
                        if(a=='superadmin')
                        {
                            that.group = "超级管理员";
                        }
                        else if(a=="admin")
                        {
                            that.group = "管理员";
                        }
                        else if(a=='staff')
                        {
                            that.group = "员工";
                        }
                        else{
                            that.group = "未知用户";
                        }
                    })

            },
        }
    })
</script>

</html>